// @ts-nocheck
import { legacy_createStore, applyMiddleware } from 'redux'
import logger from 'redux-logger'
import thunk from 'redux-thunk'

const initialState = {
  data: []
}

const reducer = (state = initialState, { type, payload }): any => {
  const newState = JSON.parse(JSON.stringify(state))

  switch (type) {
    case 'GETDATA':
      newState.data = payload
      return newState

    default:
      return newState
  }
}

export default legacy_createStore(reducer, applyMiddleware(thunk, logger))
